package com.yehongyu.mytools.core.reflect;

//: SweetShop.java
//Examination of the way the class loader works

class Candy {
	static {
		System.out.println("Loading Candy");
	}
}

class Gum {
	static {
		System.out.println("Loading Gum");
	}
}

class Cookie {
	static {
		System.out.println("Loading Cookie");
	}
}

public class SweetShop {
	public static void main(String[] args) {
//		System.out.println("inside main");
//		new Candy();
//		System.out.println("After creating Candy");
//		try {
//			Class.forName("Gum");
//		} catch (ClassNotFoundException e) {
//			e.printStackTrace();
//		}
//		System.out.println("After Class.forName(\"Gum\")");
//		new Cookie();
//		System.out.println("After creating Cookie");
		Class<?> tClass = SweetShop.class;
		for(int i=0;i<tClass.getDeclaredMethods().length;i++){
			System.out.println(tClass.getDeclaredMethods()[i].toString());
		}
		for(int i=0;i<tClass.getDeclaredConstructors().length;i++){
			System.out.println(tClass.getDeclaredConstructors()[i].toString());
		}
	}
} // /:~
